<!--#include virtual="/dzps/p1.asp"-->
<%
s1 "select content from tl_post where log1_id="& val("log1_id") 
s1 "select top 1 content from xd_p where log1_id="& val("log1_id")
if val("content")="" and val("tl_c")<>"" then 
	save_html2(val("log1_id"),val("tl_c"))
end if
s1 "select top 1 content from xd_p where log1_id="& val("log1_id")

Function save_html2(log1_id,content)
	dim conn3,rs1
	Set Conn3 = Easp.Db.GetConn
	sql = "select top 1 * from xd_p where log1_id="&log1_id
	Set rs = server.CreateObject("adodb.recordset")
	rs.open sql,conn3,1,3
	if rs.recordcount=0 then
		rs.addnew
	else
	end if
	rs("content")=content
	rs("log1_id")=val("log1_id")
	rs("user_id")=session("user_id")
	rs.update
	rs.Close
	Set rs = Nothing
End Function
%>
<!DOCTYPE html>
<html>
<head>
<%easp.include "h.asp"%>
<style type="text/css">
html {
    background-color: #fff;
}
#save2{
	display:block;
	margin:0 auto
}
</style>
</head>
<body>
  <div class="layui-form">
<%
	i_h "id",val("id")
	echo js2("textarea_no_label.html","content","心得",val("content"),"required")
%>

<div class="center">
    <div class="layui-form-item">
      <input type="button"  class="layui-btn" lay-submit lay-filter="save2" id="save2" value="确认">
    </div>
</div>
  </div>
  <script src="/<%=rootpath%>/src/layuiadmin/layui/layui.js"></script>  
  <script>
  layui.config({
    base: '/<%=rootpath%>/src/layuiadmin/' 
  }).extend({
    index: 'lib/index' 
  }).use(['index', 'set','form', 'upload','user','layedit'],function(){
    var $ = layui.$
    ,setter = layui.setter
    ,admin = layui.admin
    ,form = layui.form;  
  	var layedit = layui.layedit;
	layedit.set({
				uploadImage: {
							url: '/dzps/upload2.asp' //接口url
							,type: 'post' //默认post
							}
				});
    var index= layedit.build('content',{height: '350' }); //建立编辑器
	form.verify({
				content: function(value) { 
					return layedit.sync(index);
				}
			});	
 
      form.on('submit(save2)', function(data){
		var field = data.field;
		$.post('pjson.asp?now=' + new Date().getTime(), {
			action: "xd_add2"
			,log1_id: <%=val("log1_id")%>
			,content:layedit.getContent(index)
		},
		function(data) {
			var jsonObj = $.parseJSON(data);
			alert(jsonObj.msg);
			var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
			parent.layer.close(index); //再执行关闭  
		});
    });
 });
  </script>  
</body>
</html>